	$(document).ready(function() {
		
		/*创建协议配置页面的js代码*/

		/*认证方式*/
		$("#btn01").click(function() {
			$("#btn01").attr("disabled", "disabled");
			$("#btn01").css("background-color", "rgb(224,224,224)");
			$("#btn01").css("color", "rgb(48,148,222)");
			$("#identityConfig").css("display", "block");
		});

		$("#del01").click(function() {
			alert("删除成功！");
			$("#btn01").removeAttr("disabled");
			$("#btn01").css("background-color", "rgb(255,255,255)");
			$("#btn01").css("color", "rgb(0,0,0)");
			$("#identityConfig").css("display", "none");
		});


		/*加密协商*/
		$("#btn02").click(function() {
			$("#btn02").attr("disabled", "disabled");
			$("#btn02").css("background-color", "rgb(224,224,224)");
			$("#btn02").css("color", "rgb(48,148,222)");
			$("#encryptionConfig").css("display", "block");
		});

		$("#del02").click(function() {
			alert("删除成功！");
			$("#btn02").removeAttr("disabled");
			$("#btn02").css("background-color", "rgb(255,255,255)");
			$("#btn02").css("color", "rgb(0,0,0)");
			$("#encryptionConfig").css("display", "none");
		});
		
		/*异常检测*/
		$("#btn03").click(function() {
			$("#btn03").attr("disabled", "disabled");
			$("#btn03").css("background-color", "rgb(224,224,224)");
			$("#btn03").css("color", "rgb(48,148,222)");
			$("#exceptionConfig").css("display", "block");
		});

		$("#del03").click(function() {
			alert("删除成功！");
			$("#btn03").removeAttr("disabled");
			$("#btn03").css("background-color", "rgb(255,255,255)");
			$("#btn03").css("color", "rgb(0,0,0)");
			$("#exceptionConfig").css("display", "none");
		});
		
		/*防病毒配置*/
		$("#btn04").click(function() {
			$("#btn04").attr("disabled", "disabled");
			$("#btn04").css("background-color", "rgb(224,224,224)");
			$("#btn04").css("color", "rgb(48,148,222)");
			$("#defendConfig").css("display", "block");
		});

		$("#del04").click(function() {
			alert("删除成功！");
			$("#btn04").removeAttr("disabled");
			$("#btn04").css("background-color", "rgb(255,255,255)");
			$("#btn04").css("color", "rgb(0,0,0)");
			$("#defendConfig").css("display", "none");
		});
		
		/*重传配置*/
		$("#btn05").click(function() {
			$("#btn05").attr("disabled", "disabled");
			$("#btn05").css("background-color", "rgb(224,224,224)");
			$("#btn05").css("color", "rgb(48,148,222)");
			$("#resendConfig").css("display", "block");
		});

		$("#del05").click(function() {
			alert("删除成功！");
			$("#configContent input").val("");
			$("#btn05").removeAttr("disabled");
			$("#btn05").css("background-color", "rgb(255,255,255)");
			$("#btn05").css("color", "rgb(0,0,0)");
			$("#resendConfig").css("display", "none");
		});
		
		/*完整性配置*/
		$("#btn06").click(function() {
			$("#btn06").attr("disabled", "disabled");
			$("#btn06").css("background-color", "rgb(224,224,224)");
			$("#btn06").css("color", "rgb(48,148,222)");
			$("#integrityConfig").css("display", "block");
		});

		$("#del06").click(function() {
			alert("删除成功！");
			$("#btn06").removeAttr("disabled");
			$("#btn06").css("background-color", "rgb(255,255,255)");
			$("#btn06").css("color", "rgb(0,0,0)");
			$("#integrityConfig").css("display", "none");
		});
		
		$("#resendConfig_reset").click(function(){
			$(".resendField input").val("");
		});

		$(".attrButton").click(function() {
			//解决ie8不兼容 input中placeholder属性
			$(function() {
				// 如果不支持placeholder，用jQuery来完成
				if(!isSupportPlaceholder()) {
					// 遍历所有input对象, 除了密码框
					$('input').not("input[type='password']").each(
						function() {
							var self = $(this);
							var val = self.attr("placeholder");
							input(self, val);
						}
					);

					/**
					 *  对password框的特殊处理
					 * 1.创建一个text框 
					 * 2.获取焦点和失去焦点的时候切换
					 */
					$('input[type="password"]').each(
						function() {
							var pwdField = $(this);
							var pwdVal = pwdField.attr('placeholder');
							var pwdId = pwdField.attr('id');
							// 重命名该input的id为原id后跟1
							pwdField.after('<input id="' + pwdId + '1" type="text" value=' + pwdVal + ' autocomplete="off" />');
							var pwdPlaceholder = $('#' + pwdId + '1');
							pwdPlaceholder.show();
							pwdField.hide();

							pwdPlaceholder.focus(function() {
								pwdPlaceholder.hide();
								pwdField.show();
								pwdField.focus();
							});

							pwdField.blur(function() {
								if(pwdField.val() == '') {
									pwdPlaceholder.show();
									pwdField.hide();
								}
							});
						}
					);
				}
			});

			// 判断浏览器是否支持placeholder属性
			function isSupportPlaceholder() {
				var input = document.createElement('input');
				return 'placeholder' in input;
			}

			// jQuery替换placeholder的处理
			function input(obj, val) {
				var $input = obj;
				var val = val;
				$input.attr({
					value: val
				});
				$input.focus(function() {
					if($input.val() == val) {
						$(this).attr({
							value: ""
						});
					}
				}).blur(function() {
					if($input.val() == "") {
						$(this).attr({
							value: val
						});
					}
				});
			}

		});
		
		$("#saveBtn").click(function(){
			alert("配置保存成功");
		});

	});